/*
 * test_queue.cpp
 *
 *  Created on: Jan 4, 2014
 *      Author: killerg
 */


#include <queue>
#include <vector>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

struct mb_t {
    int stamp;
};

struct comp {
    bool operator()(mb_t* lhs, mb_t* rhs) {
        return lhs->stamp > rhs->stamp;
    }
};

bool test_queue() {
	priority_queue<mb_t*, vector<mb_t*>, comp> que;

	for (int i=0; i<10; ++i) {
	    mb_t* mb = new mb_t;
	    mb->stamp = rand() % 10;
	    que.push(mb);
	}

	while (!que.empty()) {
	    printf("%d\n", que.top()->stamp);
	    delete que.top();
	    que.pop();
	}

	return true;
}
